@extends('home.reset.reset_layout')
@section('title',$title)
@section('content')
	<div id="container" style="width: 85%; background-color: #FFFFFF;">
    <div id="content">
        <div class="mod-main mod-comm">
            <div class="mt">
                <h3>找回密码</h3>
            </div>
            <div class="mc">
                <div id="sflex04" class="stepflex ">
                    <dl class="first done">
                        <dt class="s-num">1</dt>
                        <dd class="s-text">填写账户名<s></s><b></b></dd>
                        <dd></dd>
                    </dl>
                    <dl class="normal done">
                        <dt class="s-num">2</dt>
                        <dd class="s-text">发送状态<s></s><b></b></dd>
                    </dl>
                    <dl class="normal doing">
                        <dt class="s-num">3</dt>
                        <dd class="s-text">设置新密码<s></s><b></b></dd>
                    </dl>
                    <dl class="last">
                        <dt class="s-num">&nbsp;</dt>
                        <dd class="s-text">完成<s></s><b></b></dd>
                    </dl>
                </div>

                <div class="form formno" style="width: 65%;margin-left: 30%;">
                    <div class="item phone-item" style="display:none">
                        <span class="label">历史收货人手机号码：</span>
                        <div class="fl">
                            <input type="text" tabindex="1" onfocus="mobileFocus();" onblur="historyMobileBlur();" class="itxt" id="mobile">
                            <label class="blank invisible" id="username_succeed"></label>
                            <span class="clr"></span>
                            <label id="mobile_error" class=""></label>
                        </div>
                    </div>

            <!--         <div class="item" style="display:none">
						<span class="label">
							<img src="//misc.360buyimg.com/purchase/skin/df/i/icon-quer.png" id="history-name-tip">历史收货人姓名：
						</span>
                        <div class="fl">
                            <input type="text" id="historyName" class="itxt" onblur="checkHistoryName();" onfocus="historyNameFocus();" tabindex="1">
                            <span class="clr"></span>
                            <label class="msg-error" id="historyName_error">请输入您已完成订单的收货人姓名</label>
                        </div>
                    </div> -->
					<form action="/update" method="post">
						{{csrf_field()}}
						<input type="hidden" name="id" value="{{$data -> id}}" />
						<div class="item">
	                        <span class="label">新登录密码：</span>
	                        <div class="fl">
	                            <input type="password" name="password" id="password" class="itxt" size=30 onKeyUp=pwdstrong(this.value) onBlur=pwdstrong(this.value)>

	                            <span class="clr"></span>
	                           <!--  <div class="u-safe" style="display:none" id="pwdstrength">
	                                安全程度：
	                                <i class="safe-rank06"></i>
	                            </div> -->
                                <br>密码强度:
                                <table border=1 cellspacing=0 cellpadding=1 bordercolor=#cccccc  style="float:right;">
                                    <tr align="center"> 
                                        <td width=40 id="pwd_L">弱</td>
                                        <td width=40 id="pwd_M">中</td>
                                        <td width=40 id="pwd_H">强</td>
                                    </tr>
                                </table>
	                            <span class="clr"></span>
	                            <label class="" id="password_error"></label>
	                        </div>
	                    </div>

	                    <div class="item">
	                        <span class="label">确认新密码：</span>
	                        <div class="fl">
	                            <input type="password" name="repassword" id="repassword" class="itxt" onblur="repasswordBlur();" onfocus="repasswordFocus();" tabindex="2" value="">
	                               <!-- <span class="btn-5" style="cursor:pointer" id="jc">检测两次密码是否一致</span> -->
                                   <!-- <span>两次密码一致，方可提交！</span> -->
                                <span class="clr"></span>
	                            <label class="" id="repassword_error"></label>
                                <span style="display:none;" id="byy">两次输入密码不一样,请重新输入!</span>
                                <span style="display:none;" id="yz">密码一致，请点击提交。</span>
	                        </div>
	                    </div>
                      <!--   <span class="btn-5" style="cursor:pointer">检测两次密码是否一致</span> -->
	                    <div class="item">
	                        <span class="label">&nbsp;</span>
	                        <div class="fl">
	                            <!-- <a href="javascript:void(0);" class="btn-5" id="resetPwdSubmit" onclick="updatePassword('266b36023d1c2209ebdc32e0f699f93f','','')">提交</a> -->
	                            <input type="submit" value="提交"  id="submit">
	                        </div>
	                        <div class="clr"></div>
	                    </div>
					</form>
         
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function Charstring(iN){              
    if (iN>=48 && iN <=57)                
    return 1; 
    if (iN>=65 && iN <=90)              
    return 2;
    if (iN>=97 && iN <=122)             
    return 4;
    else
    return 8;         
    }

    function modetotal(num)
    {      
        modes=0;
        for (i=0;i<4;i++){
        if (num & 1) 
            modes++;
            num>>>=1;
        }
        return modes;
    }

        function checkpwd(spwd)
        {   
            if (spwd.length<=4)
            return 0;                         
            Modes=0;
            for (i=0;i<spwd.length;i++){         
                Modes|=Charstring(spwd.charCodeAt(i));
            }
            return modetotal(Modes);
        } 

    function pwdstrong(pwd){       
        O_color="#cccccc";              
        L_color="#ffff00";               
        M_color="#DC440F";                
        H_color="#FF0000";                  
        if (pwd==null||pwd==''){             
            Lcolor=Mcolor=Hcolor=O_color;   
        } 
        else{
            S_level=checkpwd(pwd);        
            switch(S_level) {
            case 0:
                Lcolor=Mcolor=Hcolor=O_color;  
            case 1:
                Lcolor=L_color;
                Mcolor=Hcolor=O_color;           
                break;
            case 2:
                Lcolor=Mcolor=M_color;
                Hcolor=O_color;           
                break;
            default:
            Lcolor=Mcolor=Hcolor=H_color;
        }
    } 
    document.getElementById("pwd_L").style.background=Lcolor;    
    document.getElementById("pwd_M").style.background=Mcolor; 
    document.getElementById("pwd_H").style.background=Hcolor; 
    return;
    }


    $('#submit').on('click',function()
    {
        if($("#password").val() != $("#repassword").val())
        {
            alert('两次密码不一致，请重新输入');
        }
        if($("#password").val() == "" || $("#repassword").val() == "")
        {
            alert('密码不能为空');
        }
    });


     // $("input[name='repassword']").on('blur',function()
     // {
     //        $.post('/reset/password',{'_token':'{{csrf_token()}}','password':$("#password").val(),'repassword':$("#repassword").val()},function(data)
     //        {
     //            if(data == 2)
     //            {
     //                $('#byy').css('display','block');
     //                 $("input[name='repassword']").on('focus',function()
     //                 {
     //                    $('#byy').css('display','none');
     //                 });
     //                 $("input[name='password']").on('focus',function()
     //                 {
     //                    $('#byy').css('display','none');
     //                 });
     //            }else if(data == 1)
     //            {
     //                $('#yz').css('display','block');
     //                $('#post').attr('disabled',false);
     //                 $("input[name='repassword']").on('focus',function()
     //                 {
     //                    $('#yz').css('display','none');
     //                 });
     //                 $("input[name='password']").on('focus',function()
     //                 {
     //                    $('#yz').css('display','none');
     //                 });
     //            }
     //        });
     // });

</script>
@endsection